package cn.edu.zzu.demo01Thread;

/**
 * 线程礼让
 *      让出CPU的使用权
 */
public class TestYieldThread05 implements Runnable{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"线程开始");
        Thread.yield();//线程礼让
        System.out.println(Thread.currentThread().getName()+"线程结束");
    }

    public static void main(String[] args) {
        new Thread(new TestYieldThread05(), "a").start();
        new Thread(new TestYieldThread05(), "b").start();
    }
}
